#! /usr/bin/env python
# -*- coding: UTF-8 -*-

import Exec

def Tar(dir):
    '''
    Make a tar archive from one or more directories
    @param dir : Must be a list of directories
    The output of this function is piped to be recovered
    as input by another command (cf. module Export)
    '''
    Exec.runCmd('tar -cp ' + ' '.join(dir), out=2)

def Gzip(data):
    '''
    Compress the piped output of a function with GNU gzip
    The output of this function is piped to be recovered
    as input by another command (cf. module Export)
    @ param data :  must be the piped output of a command (eg. tar)
    '''
    Exec.runCmd('gzip -q9', out=2, input=data)

def Bzip2(data):
    '''
    Compress the piped output of a function with GNU gzip
    The output of this function is piped to be recovered
    as input by another command (cf. module Export)
    @ param data :  must be the piped output of a command (eg. tar)
    '''
    Exec.runCmd('bzip2 -q9', out=2, input=data)

def Lzma(data):
    '''
    Compress the piped output of a function with GNU lzma
    The output of this function is piped to be recovered
    as input by another command (cf. module Export)
    @ param data :  must be the piped output of a command (eg. tar)
    '''
    Exec.runCmd('lzma -qe', out=2, input=data)

